<template>
  <div>
    <img :src="`${$img(item.img)}`" />
    <div class="shop-info">
      <div class="shop-title">{{item.content}}</div>
      <div class="shop-price" :style="{marginBottom:showLoad? '0.12rem' : '0.24rem'}">
        <span>{{item.price}}</span>
        <span>已售{{item.sales}}</span>
      </div>
      <div class="info_reacd" v-if="item.state == 1">
        <span>新品</span>
        <span>推荐</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ['item'],
  data () {
    return {
      showLoad: true
    }
  },
  methods: {
    getMarginInfo () {
      if (this.item.state === 1) {
        this.showLoad = true
      } else {
        this.showLoad = false
      }
    }
  },
  created () {
    this.getMarginInfo()
  }
}
</script>

<style lang="scss" scoped>
img{
  width: 100%;
  height: 3.52rem;
  margin-bottom: .12rem;
}
.shop-info{
  padding: 0 .16rem;
  width: calc(100% - 0.32rem);
  .shop-title{
    margin-bottom: .16rem;
    color: #333;
    font-size: .24rem;
    line-height: .34rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }
  .shop-price{
    display: flex;
    align-items: center;
    justify-content: space-between;
    span{
      &:first-child{
        color: #FF2A1F;
        font-size: .28rem;
        line-height: .4rem;
      }
      &:last-child{
        font-size: .24rem;
        line-height: .34rem;
        color: #999;
      }
    }
  }
  .info_reacd{
    width: 100%;
    margin-bottom: .2rem;
    span{
      display: inline-block;
      padding: 0 .12rem;
      border-radius: .1rem;
      font-size: .2rem;
      border: 1px solid #FF2A1F;
      color: #FF2A1F;
      margin-right: 0.08rem;
    }
  }
}
</style>
